{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-03-20T04:59:34.390237Z",
     "start_time": "2025-03-20T04:59:07.417616Z"
    }
   },
   "source": [
    "import ray\n",
    "ray.init()\n",
    "\n",
    "@ray.remote\n",
    "def f(x):\n",
    "    return x * x\n",
    "\n",
    "futures = [f.remote(i) for i in range(4)]\n",
    "print(ray.get(futures)) # [0, 1, 4, 9]"
   ],
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2025-03-20 12:59:28,118\tINFO worker.py:1832 -- Started a local Ray instance. View the dashboard at \u001B[1m\u001B[32mhttp://127.0.0.1:8265 \u001B[39m\u001B[22m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0, 1, 4, 9]\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-20T05:43:33.164214Z",
     "start_time": "2025-03-20T05:43:29.764980Z"
    }
   },
   "cell_type": "code",
   "source": "ray.shutdown()",
   "id": "8dc4fa1563d39138",
   "outputs": [],
   "execution_count": 2
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
